/*
 * MyPannel.java
 *
 * Created on __DATE__, __TIME__
 */

package com.jh.ui;

import java.util.List;

import javax.swing.DefaultListModel;
import javax.swing.ListModel;

/**
 *
 * @author  __USER__
 */
public class ClientPannel extends javax.swing.JPanel {

	/** Creates new form MyPannel */
	public ClientPannel() {
		initComponents();
	}

	public void setList(List<String> model) {
		DefaultListModel listmodel = new DefaultListModel();
		for (String string : model) {
			listmodel.addElement(string);
		}
		jList1.setModel(listmodel);
	}


	public Object[] getSelectedList() {
		return jList1.getSelectedValues();
	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jScrollPane1 = new javax.swing.JScrollPane();
		jList1 = new javax.swing.JList();

		jList1.setModel(new javax.swing.AbstractListModel() {
			String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4",
					"Item 5" };

			public int getSize() {
				return strings.length;
			}

			public Object getElementAt(int i) {
				return strings[i];
			}
		});
		jScrollPane1.setViewportView(jList1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		this.setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup().addGap(12, 12, 12).addComponent(
						jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
						128, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup().addContainerGap().addComponent(
						jScrollPane1).addContainerGap()));
	}// </editor-fold>
	//GEN-END:initComponents

	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JList jList1;
	private javax.swing.JScrollPane jScrollPane1;
	// End of variables declaration//GEN-END:variables

}